-- 规则说明
local GuildWarReadMeView = class("GuildWarReadMeView", app.mvc.ViewBase)
local IconRender = require("app.widget.renders.IconRender")
local CrossServerGuildWarHelper = require("app.crossServer.views.guildWar.CrossServerGuildWarHelper")
GuildWarReadMeView.VIEW_ROOT_RES = Res.CSGuildWarReadMe

function GuildWarReadMeView:init()
    self.super.init(self)
    self._ui.Button_close:addClickEventListener(function()
        self:closeView()
    end)
    self._icon1 = IconRender.create(self._ui["Panel/Panel_right/Panel_item/Panel_1/icon"])
    self._icon2 = IconRender.create(self._ui["Panel/Panel_right/Panel_item/Panel_2/icon"])

    local rewards1 = CrossServerGuildWarHelper.getBattleWinAward()
    
    self._ui["Panel/Panel_right/Panel_item/Panel_1"]:setTouchEnabled(false)
    self._ui["Panel/Panel_right/Panel_item/Panel_2"]:setTouchEnabled(false)
    if rewards1 and rewards1[1] then
        self._icon1:setData(rewards1[1])
        self._icon1:setTipEnable(true)
        self._ui["Panel/Panel_right/Panel_item/Panel_1/name"]:setString(rewards1[1]:getName(true))
    end
    local rewards2 = CrossServerGuildWarHelper.getBattleLoseAward()
    if rewards2 and rewards2[1] then
        self._icon2:setData(rewards2[1])
        self._icon2:setTipEnable(true)
        self._ui["Panel/Panel_right/Panel_item/Panel_2/name"]:setString(rewards2[1]:getName(true))
    end



    self:refresh()
end

function GuildWarReadMeView:refresh()
    self._ui["Panel/Panel_right/Panel_text/text"]:setString(L("serviceGuildWarRule"))

end

return GuildWarReadMeView